import 'package:flutter/material.dart';

main() => runApp(MyApp());

// 生成代码快捷键  stl
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: GLHomePage(),
    );
  }
}

class GLHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("基础的widget"),
        ),
        body: GLHomeContent());
  }
}

class GLHomeContent extends StatefulWidget {
  const GLHomeContent({super.key});

  @override
  State<GLHomeContent> createState() => _GLHomeContentState();
}

class _GLHomeContentState extends State<GLHomeContent> {
  final imageUrl = "https://img.wmdb.tv/movie/poster/1604195051378-1dbb99.jpg";
  @override
  Widget build(BuildContext context) {
    // 1、站位图片 FadeInImage
    // 2、图片缓存：默认最多缓存1000张图片，最大100M
    return FadeInImage(
        placeholder: AssetImage("assets/images/scent_woman.jpg"),
        image: NetworkImage(imageUrl));
  }
}

class ImageDemo2 extends StatelessWidget {
  const ImageDemo2({super.key});

  @override
  Widget build(BuildContext context) {
    return Image(
        // 1、在Flutter项目中创建一个文件夹，存放图片资源
        // 2、在pubspac.yaml进行配置
        // 3、使用图片
        image: AssetImage("assets/images/scent_woman.jpg"));
  }
}
